package cate.game.rank.h.adapter;

import cate.game.GameBody;
import cate.game.framework.advanced.AdvancedRankHandler;
import cate.game.framework.advanced.AdvancedRankHandlerAdapter;
import cate.game.pvp.pointrace.data.PointRaceRank;

import static cate.game.pvp.pointrace.handler.PointRaceRankHandler.RANK_ID;

public class PointRaceRankHandlerAdapter extends AdvancedRankHandlerAdapter<PointRaceRank> {

    public PointRaceRankHandlerAdapter() {
        super(PointRaceRankHandlerAdapter::getRankHandler, RANK_ID);
    }

    public static AdvancedRankHandler<PointRaceRank> getRankHandler(GameBody gameBody) {
        return gameBody.pvp.pointRace.getHandler();
    }

    public int getRoleRank(GameBody game, String roleUid) {
        return getRankHandler(game).getIndex(roleUid);
    }
}
